{% extends 'frontend/common/basic_list.html' %}

{% block list_title %}
    机柜
{% endblock %}

{% block list_filter %}
    <div class="col-sm-3">
        <div class="input-group">
            <select class="form-control m-b" name="idc">
                <option value="" {% ifequal '' kwargs.idc %}
                        selected="selected"
                {% endifequal %}
                >----
                </option>
                {% for o in plugin_result.idc %}
                    <option value="{{ o.id }}" {% ifequal o.id kwargs.idc|str_to_int %}
                            selected="selected"
                    {% endifequal %}

                    >{{ o.name }}</option>
                {% endfor %}

            </select>
            <span
                    class="input-group-btn">
                                        <button type="submit" class="btn btn-sm btn-primary"> 搜索</button> </span>

        </div>
    </div>
    <div class="col-sm-3">
        <div class="input-group">
            <a href="cabinet_add/"
               class="btn btn-sm btn-success"><i class="fa fa-plus"></i> 新增</a>
            &nbsp;
            <a href="javascript:void(0)"
               onclick="deleteBatch()"
               class="btn btn-sm btn-danger"><i class="fa fa-trash"></i> 批量删除</a>
        </div>
    </div>
{% endblock %}

{% block list_content %}
    <table class="table table-striped table-bordered table-hover dataTables-example dataTable">
        <thead>
        <tr>
            <th><input id="checkall" type="checkbox" class="i-checks"></th>
            <th style="width: 10%;">机房</th>
            <th style="width: 10%;">机柜</th>
            <th style="width: 10%;">创建时间</th>
            <th style="width: 10%;">更新时间</th>
            <th style="width:10%;">操作</th>
        </tr>
        </thead>
        <tbody>
        {% for o in result_list %}
            <tr>
                <td style="width: 3%;">
                    <input type="checkbox" class="i-checks icheck" id="{{ o.id }}" name="input[]">
                </td>
                <td>{{ o.idc }}</td>
                <td>{{ o.name }}</td>
                <td>{{ o.create_time }}</td>
                <td>{{ o.update_time }}</td>
                <td>
                    <a href="{{ o.id }}/cabinet_edit/"
                       class="btn  btn-sm btn-info">编辑</a>
                    <a href="{{ o.id }}/delete_entity/"
                       class="btn  btn-sm btn-danger">删除</a>
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
{% endblock %}